#ifndef V_NAV_GRAPHICS_KEYMANAGER_H
#define V_NAV_GRAPHICS_KEYMANAGER_H

#include <iostream>
#include <vector>
#include <map>
#include "SDL.h"
#include "definitions/VNTypeDefs.h"

namespace vnav
{
	namespace graphics
	{
		class KeyListener;
		class KeyManager
		{
		public:
			enum KeyType {
				KEY_W = 0,
				KEY_S, 
				KEY_A,
				KEY_D,
				KEY_UP,
				KEY_DOWN,
				KEY_LEFT,
				KEY_RIGHT,
				KEY_Q,
				KEY_E,
				KEY_Z,
				KEY_X,
				KEY_UNKNOWN
			};
			static KeyManager* instance();
			~KeyManager();
			void keyPressed(SDLKey key);
			void keyReleased(SDLKey key);
			bool isKeyDown(KeyType key);
			void registerOnKeyEvent(KeyListener* listener);
			void unregisterOnKeyEvent(KeyListener* listener);
		protected:
		private:
			std::vector<KeyListener*> m_keyListeners;
			static KeyManager* m_Self;
			std::map<KeyType, VNBool> m_Keys;
			KeyManager();
			KeyType getKeyType(SDLKey key);
		};
	}
}

#endif